<template>
  <div class="page-container">
    <!--工具栏-->
    <div class="toolbar" style="float:left;padding-top:10px;padding-left:15px;">
      <el-form
        :model="dataForm"
        label-width="150px"
        :rules="dataFormRules"
        ref="dataForm"
        :size="size">
        <el-form-item label="ID" prop="id" v-if="false">
          <el-input v-model="dataForm.id" :disabled="true" auto-complete="off"></el-input>
        </el-form-item>
        <el-form-item label="采购时效设置(天)" prop="key">
          <el-input v-model="dataForm.purchaseTimeConfig" auto-complete="off" maxlength="10"></el-input>
        </el-form-item>
        <el-form-item label="经销合同生效前" prop="val">
          <el-input v-model="dataForm.purchaseContractEffectiveWarningDay" auto-complete="off" maxlength="10"></el-input>
        </el-form-item>
        <el-form-item label="经销合同失效前" prop="type">
          <el-input v-model="dataForm.purchaseContractExpireWarningDay" auto-complete="off" maxlength="10"></el-input>
        </el-form-item>
      </el-form>
      <div slot="footer" class="dialog-footer" style="text-align:center">
        <el-button
          :size="size"
          type="primary"
          @click.native="submitForm"
          :loading="editLoading"
        >{{$t('action.submit')}}</el-button>
      </div>
    </div>
  </div>
</template>

<script>
import KtButton from "@/views/Core/KtButton";
import { format } from "@/utils/datetime";
import TableColumnFilterDialog from "@/views/Core/TableColumnFilterDialog";
export default {
  components: {
    KtButton,
    TableColumnFilterDialog
  },
  data() {
    return {
      size: "small",
      // 新增编辑界面数据
      dataForm: {
        id: "",
        purchaseTimeConfig: "1",
        purchaseContractEffectiveWarningDay: "1",
        purchaseContractExpireWarningDay: "1"
      }
    };
  },
  methods: {
    // 编辑
    submitForm: function() {
      this.$refs.dataForm.validate(valid => {
        if (valid) {
          this.$confirm("确认提交吗？", "提示", {}).then(() => {
            let params = Object.assign({}, this.dataForm);
            var this_ = this;
            this_.$message({ message: "更新成功", type: "success" });
          });
        }
      });
    },
    // 时间格式化
    dateFormat: function(row, column, cellValue, index) {
      return format(row[column.property]);
    },
  },
  mounted() {
  }
};
</script>

<style scoped>
</style>